package com.ssm.hj.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ssm.hj.page.Page;
import com.ssm.hj.search.RoleSearch;
import com.ssm.hj.service.RoleService;
import com.ssm.mapper.RoleMapper;
import com.ssm.pojo.Role;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class RoleServiceImpl implements RoleService {
    @Resource
    private RoleMapper roleMapper;
    @Override
    //  阿杰 查询所有角色
    public PageInfo<Role> queryRoleAllService(Page<RoleSearch> page) throws Exception {
        PageHelper.startPage(page.getPageNum(),page.getPageSize());
        return new PageInfo<Role>(this.roleMapper.queryRoleAll(page.getSearchObj()));
    }

    @Override
    // 阿杰 修改角色状态
    public int updateRoleStateService(int id, int state) throws Exception {
        return this.roleMapper.updateRoleState(id,state);
    }
}
